﻿@model com.fmtx.Model.Article
@{
    ViewBag.Title = "Index";
}


<form id="f1" class="row-fluid well" action="/Write/Article/Edit" method="post">
<div class="span7" >
    <fieldset>
        <legend>
            <div class="control-group" style="margin-top:0px;">
            <div class="controls">
               标题：@Html.TextBoxFor(m => m.Title, new {@class="input-xxlarge",placeholder="游记标题" })
            <label class="help-inline" style="font-size:12px;" >@Html.ValidationMessageFor(m => m.Title)</label>
            </div>
        </div>
            </legend>
        <div class="control-group" style="margin-top:0px;">
            <div class="controls">
                @Html.TextAreaFor(m=>m.Content,new{ @class="editor",style="width:100%; height:600px;"})
                <label class="help-inline" style="font-size:12px;" >@Html.ValidationMessageFor(m => m.Content)</label>
            </div>
        </div>
        </fieldset>
</div>
<div id="write_right" class="span5 well" >
    <fieldset>
        <legend style="margin-bottom: 0px;">编辑属性</legend>
        <div class="control-group">
            <label class="control-label" for="TypeId">分类</label>
            <div class="controls">
            <select class="input-medium"  name="TypeId" id="seltype">
                @if (ViewBag.typelist != null)
                {
                    foreach (com.fmtx.Model.ArticleType item in ViewBag.typelist)
                    {
                        <option value="@item.Id">@item.Name</option>
                    }
                }
               </select>
              <a onclick="openAddtypebox()">添加</a>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="PlaceTag">关键词</label>
          <div class="controls">
              @Html.TextAreaFor(m => m.KeyWord, new { placeholder="关键词",@class="input-large" })
            <label class="help-inline" style="font-size:12px;" >关键词可以方便更多的人找到这篇文章，请以空格或者逗号分隔 最多15个字</label>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="PlaceTag">热门关键词</label>
          <div class="controls">
            <ul class="unstyled lifloatmargin">
                @if(ViewBag.Keyword!=null){
                    foreach (var item in ViewBag.Keyword)
                    {
                        <li><a onclick="setlabel(this,'#KeyWord')">@item.Keyword</a></li>
                    }
                }
            </ul>
          </div>
        </div>
        <div style="clear:both;"></div>
    </fieldset>
</div>
<div style="clear:both;"></div>
<div class="form-actions articlesavebtn" style="text-align: center;" >
    @Html.HiddenFor(m=>m.Id)
    @Html.HiddenFor(m=>m.FrontCover)
    <button id="fat-btn" data-loading-text="加载中..." class="btn btn-primary" style="width:120px; line-height:30px;font-size:20px;">保存</button>
    </div>
</form>

<div style="clear:both;"></div>

<script type="text/template" id="templatetype_add">
<div class="well" style="margin-bottom: 0px">
    <span style="position: absolute;top: -10px;right: -10px;cursor: pointer;" onclick="ClosemsgModal()"><img src="/css/images/x.png"/></span>
    <input type="text" class="focused" />
    <input type="button" class="btn" onclick="dosavetype(this)" value="确定"/>
    </div>
</script>

@section scripts{
    @Scripts.Render("~/js/jqueryval")
    <script src="~/js/kindeditor/kindeditor-min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            createEditor("#Content");
            $("select[name=TypeId] option[value=@Model.TypeId]").attr("selected", true);
        $("input[name=CityName]").fmtxDropdown({ url: "/action/area/CityBykey", value: "CityId" });
        $("input[name=PlaceName]").fmtxDropdown({
            url: "/action/area/PlaceBykey", value: "PlaceId", param: "input[name=CityId]", paramkey: "cityid", change: function (id, name) {
                $.get("/action/area/GetCityByPlace", { placeid: id }, function (data) {
                    $("input[name=CityName]").val(data.CityName);
                    $("input[name=CityId]").val(data.CityId);
                });
            }
        });


    });
    $(function () {
        var btn = $("#fat-btn")
        btn.click(function () {
            var text = $(this).attr("data-loading-text");
            btn.attr('data-loading-text', btn.text());
            btn.text(text);
            btn.attr("disabled", "disabled");
            btn.addClass("disabled");
            $("#f1").submit();
            setTimeout(function () {
                var text = btn.attr("data-loading-text");
                btn.attr('data-loading-text', btn.text());
                btn.text(text);
                btn.removeAttr("disabled");
                btn.removeClass("disabled");
            }, 2500)
        });
    })
    setmainmenu("article");
</script>
}
 
